﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace Stacktest
{
    class Program
    {
        static void Main(string[] args)
        {
            Stack stack = new Stack();
 

            stack.Push("aa");

 
            stack.Push("bb");

 
            stack.Push("cc");
 

            foreach (var item in stack)
 
            {
 

            Console.WriteLine(item);

 
        }

            stack.Push("aaa");
 
            stack.Push("bbb");
  
            stack.Clear();
 

            stack.Push("ccc");

 
            foreach (var item1 in stack)

 
        {
 
            Console.WriteLine(item1);
 

            }

            stack.Push("aaaa");
 
            stack.Push("bbbb");
 
            stack.Push("cccc");
 
            Console.WriteLine(stack.Contains("aa"));






            stack.Push("哈哈");
            stack.Push("嘿嘿");
            stack.Push("嘻嘻");
            object[] arr = new object[3];
            stack.CopyTo(arr, 0);
            foreach (var item2 in arr)
            {
                Console.WriteLine(item2);
            }

            stack.Push("因为");
            stack.Push("有你");
            stack.Push("爱了");
            Console.WriteLine(stack.Peek());
            foreach (var item3 in stack)
            {
                Console.WriteLine(item3);
            }






            stack.Push("遇见");
            stack.Push("你是");
            stack.Push("我最大的快乐！");
            Console.WriteLine(stack.Pop());
            foreach (var item4 in stack)
            {
                Console.WriteLine(item4);
            }



            stack.Push("从你");
 
            stack.Push("的全世界");
 
            stack.Push("路过");
 
            object[] arr1 = stack.ToArray();

 
            foreach (var item5 in arr)

            {
  
             Console.WriteLine(item5);
  
            }


            Stack<string> st = new Stack<string>();

            string s = Console.ReadLine();

            char[] a = s.ToCharArray();

            foreach (var item in a)

            {

                st.Push(item.ToString());

            }

            while (st.Count > 0)

            {

                Console.Write(st.Pop());

            }

            Console.ReadKey();

        }
    }
}
